//
//  SY_AttendanceStudentCell.m
//  ChatDemo-UI2.0
//
//  Created by Sylar on 2017/2/15.
//  Copyright © 2017年 Sylar. All rights reserved.
//

#import "SY_AttendanceStudentCell.h"


@implementation SY_AttendanceStudentCell {
    
    UILabel *nameLabel;
    UILabel *leaveLabel;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 0, 44)];
        [nameLabel setFont:[UIFont systemFontOfSize:16]];
        [nameLabel setTextColor:colorFromHex(@"#3b3b3b")];
        [self.contentView addSubview:nameLabel];
        
        leaveLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 200, 44)];
        [leaveLabel setFont:[UIFont systemFontOfSize:16]];
        [leaveLabel setTextColor:colorFromHex(@"#979797")];
        [self.contentView addSubview:leaveLabel];
        
        self.cheakImg = [[UIImageView alloc]initWithFrame:CGRectMake(SCREENWIDTH - 35, 12, 20, 20)];
        [self.contentView addSubview:self.cheakImg];
        
        
    }
    
    return self;
}

- (void)ceratCell:(NSDictionary *)detailDic {
    
    nameLabel.text = [detailDic objectForKey:@"studentname"];
    nameLabel.width = [[detailDic objectForKey:@"studentname"] length] * 16 + 5;
    
    if ([[detailDic objectForKey:@"leavename"] length] > 0) {
        leaveLabel.x = nameLabel.right;
        leaveLabel.text = [NSString stringWithFormat:@"(%@)",[detailDic objectForKey:@"leavename"]];
    }
    
    if ([[detailDic objectForKey:@"check"] integerValue] ==1) {
        [self.cheakImg setImage:[UIImage imageWithOriginalName:@"homeworks_allchoose_press_"]];
        
    }else
    {
       [self.cheakImg setImage:[UIImage imageWithOriginalName:@"homeworks_allchoose_nor_"]];
        
    }
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
